<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>marshal - RDoc Documentation</title>


<script src="./js/navigation.js" defer></script>
<script src="./js/search.js" defer></script>
<script src="./js/search_index.js" defer></script>
<script src="./js/searcher.js" defer></script>
<script src="./js/darkfish.js" defer></script>

<script src="./js/jquery-3.2.0.min.js"></script>

<script src="./js/vue.min.js"></script>
<script src="./js/js.cookie.min.js"></script>

<link href="./css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="./css/rdoc.css" rel="stylesheet">
<link href="./css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "./";
  var index_rel_prefix = "./";
  var darkModeCsseHref = "./css/rdoc-dm.css"
  var defaultModeCssHref = "./css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="file">
  <!-- this is page.html -->
  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0-preview2 NOT FOUND -->
  </div> <!-- end action bar -->


 <div class='wrapper hdiv'>

 


<nav id='vapp' role="navigation">
  <div id="project-navigation">
    <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="./index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="./table_of_contents.html#pages">Pages</a>
    <a href="./table_of_contents.html#classes">Classes</a>
    <a href="./table_of_contents.html#methods">Methods</a>
  </div>
</div>

    <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

  </div>

  
<div class="nav-section">
  <h3>Table of Contents</h3>

  <ul class="link-list" role="directory">
    <li><a href="#label-Marshal+Format">Marshal Format</a>
    <li><a href="#label-Stream+Format">Stream Format</a>
    <li><a href="#label-true-2C+false-2C+nil">true, false, nil</a>
    <li><a href="#label-Fixnum+and+long">Fixnum and long</a>
    <li><a href="#label-Symbols+and+Byte+Sequence">Symbols and Byte Sequence</a>
    <li><a href="#label-Object+References">Object References</a>
    <li><a href="#label-Instance+Variables">Instance Variables</a>
    <li><a href="#label-Extended">Extended</a>
    <li><a href="#label-Array">Array</a>
    <li><a href="#label-Bignum">Bignum</a>
    <li><a href="#label-Class+and+Module">Class and Module</a>
    <li><a href="#label-Data">Data</a>
    <li><a href="#label-Float">Float</a>
    <li><a href="#label-Hash+and+Hash+with+Default+Value">Hash and Hash with Default Value</a>
    <li><a href="#label-Module+and+Old+Module">Module and Old Module</a>
    <li><a href="#label-Object">Object</a>
    <li><a href="#label-Regular+Expression">Regular Expression</a>
    <li><a href="#label-String">String</a>
    <li><a href="#label-Struct">Struct</a>
    <li><a href="#label-User+Class">User Class</a>
    <li><a href="#label-User+Defined">User Defined</a>
    <li><a href="#label-User+Marshal">User Marshal</a>
  </ul>
</div>

  <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>

  <div id="project-metadata">
   <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
    
<div id="fileindex-section" class="nav-section">
  <h3>Pages</h3>

  <ul class="link-list">
    <li><a href="./NEWS/NEWS-1_8_7.html">NEWS-1.8.7</a>
    <li><a href="./NEWS/NEWS-1_9_1.html">NEWS-1.9.1</a>
    <li><a href="./NEWS/NEWS-1_9_2.html">NEWS-1.9.2</a>
    <li><a href="./NEWS/NEWS-1_9_3.html">NEWS-1.9.3</a>
    <li><a href="./NEWS/NEWS-2_0_0.html">NEWS-2.0.0</a>
    <li><a href="./NEWS/NEWS-2_1_0.html">NEWS-2.1.0</a>
    <li><a href="./NEWS/NEWS-2_2_0.html">NEWS-2.2.0</a>
    <li><a href="./NEWS/NEWS-2_3_0.html">NEWS-2.3.0</a>
    <li><a href="./NEWS/NEWS-2_4_0.html">NEWS-2.4.0</a>
    <li><a href="./NEWS/NEWS-2_5_0.html">NEWS-2.5.0</a>
    <li><a href="./NEWS/NEWS-2_6_0.html">NEWS-2.6.0</a>
    <li><a href="./NEWS/NEWS-2_7_0.html">NEWS-2.7.0</a>
    <li><a href="./NEWS/NEWS-3_0_0_md.html">NEWS-3.0.0</a>
    <li><a href="./NEWS/NEWS-3_1_0_md.html">NEWS-3.1.0</a>
    <li><a href="./NEWS/NEWS-3_2_0_md.html">NEWS-3.2.0</a>
    <li><a href="./bsearch_rdoc.html">bsearch</a>
    <li><a href="./bug_triaging_rdoc.html">bug_triaging</a>
    <li><a href="./case_mapping_rdoc.html">case_mapping</a>
    <li><a href="./character_selectors_rdoc.html">character_selectors</a>
    <li><a href="./command_injection_rdoc.html">command_injection</a>
    <li><a href="./contributing_md.html">contributing</a>
    <li><a href="./contributing/building_ruby_md.html">building_ruby</a>
    <li><a href="./contributing/documentation_guide_md.html">documentation_guide</a>
    <li><a href="./contributing/glossary_md.html">glossary</a>
    <li><a href="./contributing/making_changes_to_ruby_md.html">making_changes_to_ruby</a>
    <li><a href="./contributing/making_changes_to_stdlibs_md.html">making_changes_to_stdlibs</a>
    <li><a href="./contributing/reporting_issues_md.html">reporting_issues</a>
    <li><a href="./contributing/testing_ruby_md.html">testing_ruby</a>
    <li><a href="./dig_methods_rdoc.html">dig_methods</a>
    <li><a href="./distribution_md.html">distribution</a>
    <li><a href="./dtrace_probes_rdoc.html">dtrace_probes</a>
    <li><a href="./encodings_rdoc.html">encodings</a>
    <li><a href="./extension_ja_rdoc.html">extension.ja</a>
    <li><a href="./extension_rdoc.html">extension</a>
    <li><a href="./fiber_md.html">fiber</a>
    <li><a href="./format_specifications_rdoc.html">format_specifications</a>
    <li><a href="./globals_rdoc.html">globals</a>
    <li><a href="./implicit_conversion_rdoc.html">implicit_conversion</a>
    <li><a href="./keywords_rdoc.html">keywords</a>
    <li><a href="./maintainers_md.html">maintainers</a>
    <li><a href="./marshal_rdoc.html">marshal</a>
    <li><a href="./memory_view_md.html">memory_view</a>
    <li><a href="./optparse/argument_converters_rdoc.html">argument_converters</a>
    <li><a href="./optparse/creates_option_rdoc.html">creates_option</a>
    <li><a href="./optparse/option_params_rdoc.html">option_params</a>
    <li><a href="./optparse/tutorial_rdoc.html">tutorial</a>
    <li><a href="./packed_data_rdoc.html">packed_data</a>
    <li><a href="./ractor_md.html">ractor</a>
    <li><a href="./regexp_rdoc.html">regexp</a>
    <li><a href="./regexp/methods_rdoc.html">methods</a>
    <li><a href="./regexp/unicode_properties_rdoc.html">unicode_properties</a>
    <li><a href="./ruby_3_3_0_preview2/COPYING.html">COPYING</a>
    <li><a href="./ruby_3_3_0_preview2/COPYING_ja.html">COPYING.ja</a>
    <li><a href="./ruby_3_3_0_preview2/LEGAL.html">LEGAL</a>
    <li><a href="./ruby_3_3_0_preview2/NEWS_md.html">NEWS</a>
    <li><a href="./ruby_3_3_0_preview2/README_ja_md.html">README.ja</a>
    <li><a href="./ruby_3_3_0_preview2/README_md.html">README</a>
    <li><a href="./security_rdoc.html">security</a>
    <li><a href="./signals_rdoc.html">signals</a>
    <li><a href="./standard_library_rdoc.html">standard_library</a>
    <li><a href="./strftime_formatting_rdoc.html">strftime_formatting</a>
    <li><a href="./syntax_rdoc.html">syntax</a>
    <li><a href="./syntax/assignment_rdoc.html">assignment</a>
    <li><a href="./syntax/calling_methods_rdoc.html">calling_methods</a>
    <li><a href="./syntax/comments_rdoc.html">comments</a>
    <li><a href="./syntax/control_expressions_rdoc.html">control_expressions</a>
    <li><a href="./syntax/exceptions_rdoc.html">exceptions</a>
    <li><a href="./syntax/literals_rdoc.html">literals</a>
    <li><a href="./syntax/methods_rdoc.html">methods</a>
    <li><a href="./syntax/miscellaneous_rdoc.html">miscellaneous</a>
    <li><a href="./syntax/modules_and_classes_rdoc.html">modules_and_classes</a>
    <li><a href="./syntax/pattern_matching_rdoc.html">pattern_matching</a>
    <li><a href="./syntax/precedence_rdoc.html">precedence</a>
    <li><a href="./syntax/refinements_rdoc.html">refinements</a>
    <li><a href="./timezones_rdoc.html">timezones</a>
    <li><a href="./windows_md.html">windows</a>
    <li><a href="./yjit/yjit_md.html">yjit</a>
    <li><a href="./yjit/yjit_hacking_md.html">yjit_hacking</a>
  </ul>
</div>

   </div>
  </div>
</nav>


<!--  carbon ads here -->

<div id='extraz'>
  <div class='adzbox-index'  >
   
  </div>
 </div>         


<main role="main" aria-label="Page marshal.rdoc">

<h1 id="label-Marshal+Format"><a href="Marshal.html"><code>Marshal</code></a> Format<span><a href="#label-Marshal+Format">&para;</a> <a href="#top">&uarr;</a></span></h1>

<p>The <a href="Marshal.html"><code>Marshal</code></a> format is used to serialize ruby objects.  The format can store arbitrary objects through three user-defined extension mechanisms.</p>

<p>For documentation on using <a href="Marshal.html"><code>Marshal</code></a> to serialize and deserialize objects, see the <a href="Marshal.html"><code>Marshal</code></a> module.</p>

<p>This document calls a serialized set of objects a stream.  The Ruby implementation can load a set of objects from a <a href="String.html"><code>String</code></a>, an <a href="IO.html"><code>IO</code></a> or an object that implements a <code>getc</code> method.</p>

<h2 id="label-Stream+Format">Stream Format<span><a href="#label-Stream+Format">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>The first two bytes of the stream contain the major and minor version, each as a single byte encoding a digit.  The version implemented in Ruby is 4.8 (stored as “x04x08”) and is supported by ruby 1.8.0 and newer.</p>

<p>Different major versions of the <a href="Marshal.html"><code>Marshal</code></a> format are not compatible and cannot be understood by other major versions.  Lesser minor versions of the format can be understood by newer minor versions.  Format 4.7 can be loaded by a 4.8 implementation but format 4.8 cannot be loaded by a 4.7 implementation.</p>

<p>Following the version bytes is a stream describing the serialized object.  The stream contains nested objects (the same as a Ruby object) but objects in the stream do not necessarily have a direct mapping to the Ruby object model.</p>

<p>Each object in the stream is described by a byte indicating its type followed by one or more bytes describing the object.  When “object” is mentioned below it means any of the types below that defines a Ruby object.</p>

<h3 id="label-true-2C+false-2C+nil">true, false, nil<span><a href="#label-true-2C+false-2C+nil">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>These objects are each one byte long.  “T” is represents <code>true</code>, “F” represents <code>false</code> and “0” represents <code>nil</code>.</p>

<h3 id="label-Fixnum+and+long">Fixnum and long<span><a href="#label-Fixnum+and+long">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>“i” represents a signed 32 bit value using a packed format.  One through five bytes follows the type.  The value loaded will always be a Fixnum.  On 32 bit platforms (where the precision of a Fixnum is less than 32 bits) loading large values will cause overflow on CRuby.</p>

<p>The fixnum type is used to represent both ruby Fixnum objects and the sizes of marshaled arrays, hashes, instance variables and other types.  In the following sections “long” will mean the format described below, which supports full 32 bit precision.</p>

<p>The first byte has the following special values:</p>
<dl class="rdoc-list note-list"><dt>“x00”
<dd>
<p>The value of the integer is 0.  No bytes follow.</p>
</dd><dt>“x01”
<dd>
<p>The total size of the integer is two bytes.  The following byte is a positive integer in the range of 0 through 255.  Only values between 123 and 255 should be represented this way to save bytes.</p>
</dd><dt>“xff”
<dd>
<p>The total size of the integer is two bytes.  The following byte is a negative integer in the range of -1 through -256.</p>
</dd><dt>“x02”
<dd>
<p>The total size of the integer is three bytes.  The following two bytes are a positive little-endian integer.</p>
</dd><dt>“xfe”
<dd>
<p>The total size of the integer is three bytes.  The following two bytes are a negative little-endian integer.</p>
</dd><dt>“x03”
<dd>
<p>The total size of the integer is four bytes.  The following three bytes are a positive little-endian integer.</p>
</dd><dt>“xfd”
<dd>
<p>The total size of the integer is four bytes.  The following three bytes are a negative little-endian integer.</p>
</dd><dt>“x04”
<dd>
<p>The total size of the integer is five bytes.  The following four bytes are a positive little-endian integer.  For compatibility with 32 bit ruby, only Fixnums less than 1073741824 should be represented this way.  For sizes of stream objects full precision may be used.</p>
</dd><dt>“xfc”
<dd>
<p>The total size of the integer is five bytes.  The following four bytes are a negative little-endian integer.  For compatibility with 32 bit ruby, only Fixnums greater than -10737341824 should be represented this way.  For sizes of stream objects full precision may be used.</p>
</dd></dl>

<p>Otherwise the first byte is a sign-extended eight-bit value with an offset. If the value is positive the value is determined by subtracting 5 from the value.  If the value is negative the value is determined by adding 5 to the value.</p>

<p>There are multiple representations for many values.  CRuby always outputs the shortest representation possible.</p>

<h3 id="label-Symbols+and+Byte+Sequence">Symbols and Byte Sequence<span><a href="#label-Symbols+and+Byte+Sequence">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>“:” represents a real symbol.  A real symbol contains the data needed to define the symbol for the rest of the stream as future occurrences in the stream will instead be references (a symbol link) to this one.  The reference is a zero-indexed 32 bit value (so the first occurrence of <code>:hello</code> is 0).</p>

<p>Following the type byte is byte sequence which consists of a long indicating the number of bytes in the sequence followed by that many bytes of data.  Byte sequences have no encoding.</p>

<p>For example, the following stream contains the <a href="Symbol.html"><code>Symbol</code></a> <code>:hello</code>:</p>

<pre class="ruby"><span class="ruby-string">&quot;\x04\x08:\x0ahello&quot;</span>
</pre>

<p>“;” represents a <a href="Symbol.html"><code>Symbol</code></a> link which references a previously defined <a href="Symbol.html"><code>Symbol</code></a>. Following the type byte is a long containing the index in the lookup table for the linked (referenced) <a href="Symbol.html"><code>Symbol</code></a>.</p>

<p>For example, the following stream contains <code>[:hello, :hello]</code>:</p>

<pre class="ruby"><span class="ruby-string">&quot;\x04\b[\a:\nhello;\x00&quot;</span>
</pre>

<p>When a “symbol” is referenced below it may be either a real symbol or a symbol link.</p>

<h3 id="label-Object+References"><a href="Object.html"><code>Object</code></a> References<span><a href="#label-Object+References">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>Separate from but similar to symbol references, the stream contains only one copy of each object (as determined by object_id) for all objects except true, false, nil, Fixnums and Symbols (which are stored separately as described above) a one-indexed 32 bit value will be stored and reused when the object is encountered again.  (The first object has an index of 1).</p>

<p>“@” represents an object link.  Following the type byte is a long giving the index of the object.</p>

<p>For example, the following stream contains an <a href="Array.html"><code>Array</code></a> of the same <code>&quot;hello&quot;</code> object twice:</p>

<pre class="ruby"><span class="ruby-string">&quot;\004\b[\a\&quot;\nhello@\006&quot;</span>
</pre>

<h3 id="label-Instance+Variables">Instance Variables<span><a href="#label-Instance+Variables">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>“I” indicates that instance variables follow the next object.  An object follows the type byte.  Following the object is a length indicating the number of instance variables for the object.  Following the length is a set of name-value pairs.  The names are symbols while the values are objects.  The symbols must be instance variable names (<code>:@name</code>).</p>

<p>An <a href="Object.html"><code>Object</code></a> (“o” type, described below) uses the same format for its instance variables as described here.</p>

<p>For a <a href="String.html"><code>String</code></a> and <a href="Regexp.html"><code>Regexp</code></a> (described below) a special instance variable <code>:E</code> is used to indicate the <a href="Encoding.html"><code>Encoding</code></a>.</p>

<h3 id="label-Extended">Extended<span><a href="#label-Extended">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>“e” indicates that the next object is extended by a module.  An object follows the type byte.  Following the object is a symbol that contains the name of the module the object is extended by.</p>

<h3 id="label-Array"><a href="Array.html"><code>Array</code></a><span><a href="#label-Array">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>“[” represents an <a href="Array.html"><code>Array</code></a>.  Following the type byte is a long indicating the number of objects in the array.  The given number of objects follow the length.</p>

<h3 id="label-Bignum">Bignum<span><a href="#label-Bignum">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>“l” represents a Bignum which is composed of three parts:</p>
<dl class="rdoc-list note-list"><dt>sign
<dd>
<p>A single byte containing “+” for a positive value or “-” for a negative value.</p>
</dd><dt>length
<dd>
<p>A long indicating the number of bytes of Bignum data follows, divided by two.  Multiply the length by two to determine the number of bytes of data that follow.</p>
</dd><dt>data
<dd>
<p>Bytes of Bignum data representing the number.</p>
</dd></dl>

<p>The following ruby code will reconstruct the Bignum value from an array of bytes:</p>

<pre class="ruby"><span class="ruby-identifier">result</span> = <span class="ruby-value">0</span>

<span class="ruby-identifier">bytes</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">byte</span>, <span class="ruby-identifier">exp</span><span class="ruby-operator">|</span>
 <span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> (<span class="ruby-identifier">byte</span> <span class="ruby-operator">*</span> <span class="ruby-value">2</span> <span class="ruby-operator">**</span> (<span class="ruby-identifier">exp</span> <span class="ruby-operator">*</span> <span class="ruby-value">8</span>))
<span class="ruby-keyword">end</span>
</pre>

<h3 id="label-Class+and+Module"><a href="Class.html"><code>Class</code></a> and <a href="Module.html"><code>Module</code></a><span><a href="#label-Class+and+Module">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>“c” represents a <a href="Class.html"><code>Class</code></a> object, “m” represents a <a href="Module.html"><code>Module</code></a> and “M” represents either a class or module (this is an old-style for compatibility).  No class or module content is included, this type is only a reference.  Following the type byte is a byte sequence which is used to look up an existing class or module, respectively.</p>

<p>Instance variables are not allowed on a class or module.</p>

<p>If no class or module exists an exception should be raised.</p>

<p>For “c” and “m” types, the loaded object must be a class or module, respectively.</p>

<h3 id="label-Data"><a href="Data.html"><code>Data</code></a><span><a href="#label-Data">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>“d” represents a <a href="Data.html"><code>Data</code></a> object.  (<a href="Data.html"><code>Data</code></a> objects are wrapped pointers from ruby extensions.)  Following the type byte is a symbol indicating the class for the <a href="Data.html"><code>Data</code></a> object and an object that contains the state of the <a href="Data.html"><code>Data</code></a> object.</p>

<p>To dump a <a href="Data.html"><code>Data</code></a> object Ruby calls _dump_data.  To load a <a href="Data.html"><code>Data</code></a> object Ruby calls _load_data with the state of the object on a newly allocated instance.</p>

<h3 id="label-Float"><a href="Float.html"><code>Float</code></a><span><a href="#label-Float">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>“f” represents a <a href="Float.html"><code>Float</code></a> object.  Following the type byte is a byte sequence containing the float value.  The following values are special:</p>
<dl class="rdoc-list note-list"><dt>“inf”
<dd>
<p>Positive infinity</p>
</dd><dt>“-inf”
<dd>
<p>Negative infinity</p>
</dd><dt>“nan”
<dd>
<p>Not a Number</p>
</dd></dl>

<p>Otherwise the byte sequence contains a C double (loadable by strtod(3)). Older minor versions of <a href="Marshal.html"><code>Marshal</code></a> also stored extra mantissa bits to ensure portability across platforms but 4.8 does not include these.  See</p>
<dl class="rdoc-list label-list"><dt>ruby-talk:69518
<dd>
<p>for some explanation.</p>
</dd></dl>

<h3 id="label-Hash+and+Hash+with+Default+Value"><a href="Hash.html"><code>Hash</code></a> and <a href="Hash.html"><code>Hash</code></a> with Default Value<span><a href="#label-Hash+and+Hash+with+Default+Value">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>“{” represents a <a href="Hash.html"><code>Hash</code></a> object while “}” represents a <a href="Hash.html"><code>Hash</code></a> with a default value set (<code>Hash.new 0</code>).  Following the type byte is a long indicating the number of key-value pairs in the <a href="Hash.html"><code>Hash</code></a>, the size.  Double the given number of objects follow the size.</p>

<p>For a <a href="Hash.html"><code>Hash</code></a> with a default value, the default value follows all the pairs.</p>

<h3 id="label-Module+and+Old+Module"><a href="Module.html"><code>Module</code></a> and Old <a href="Module.html"><code>Module</code></a><span><a href="#label-Module+and+Old+Module">&para;</a> <a href="#top">&uarr;</a></span></h3>

<h3 id="label-Object"><a href="Object.html"><code>Object</code></a><span><a href="#label-Object">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>“o” represents an object that doesn’t have any other special form (such as a user-defined or built-in format).  Following the type byte is a symbol containing the class name of the object.  Following the class name is a long indicating the number of instance variable names and values for the object. Double the given number of pairs of objects follow the size.</p>

<p>The keys in the pairs must be symbols containing instance variable names.</p>

<h3 id="label-Regular+Expression">Regular Expression<span><a href="#label-Regular+Expression">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>“/” represents a regular expression.  Following the type byte is a byte sequence containing the regular expression source.  Following the type byte is a byte containing the regular expression options (case-insensitive, etc.) as a signed 8-bit value.</p>

<p>Regular expressions can have an encoding attached through instance variables (see above).  If no encoding is attached escapes for the following regexp specials not present in ruby 1.8 must be removed: g-m, o-q, u, y, E, F, H-L, N-V, X, Y.</p>

<h3 id="label-String"><a href="String.html"><code>String</code></a><span><a href="#label-String">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>‘“’ represents a <a href="String.html"><code>String</code></a>.  Following the type byte is a byte sequence containing the string content.  When dumped from ruby 1.9 an encoding instance variable (<code>:E</code> see above) should be included unless the encoding is binary.</p>

<h3 id="label-Struct"><a href="Struct.html"><code>Struct</code></a><span><a href="#label-Struct">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>“S” represents a <a href="Struct.html"><code>Struct</code></a>.  Following the type byte is a symbol containing the name of the struct.  Following the name is a long indicating the number of members in the struct.  Double the number of objects follow the member count. Each member is a pair containing the member’s symbol and an object for the value of that member.</p>

<p>If the struct name does not match a <a href="Struct.html"><code>Struct</code></a> subclass in the running ruby an exception should be raised.</p>

<p>If there is a mismatch between the struct in the currently running ruby and the member count in the marshaled struct an exception should be raised.</p>

<h3 id="label-User+Class">User <a href="Class.html"><code>Class</code></a><span><a href="#label-User+Class">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>“C” represents a subclass of a <a href="String.html"><code>String</code></a>, <a href="Regexp.html"><code>Regexp</code></a>, <a href="Array.html"><code>Array</code></a> or <a href="Hash.html"><code>Hash</code></a>.  Following the type byte is a symbol containing the name of the subclass.  Following the name is the wrapped object.</p>

<h3 id="label-User+Defined">User Defined<span><a href="#label-User+Defined">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>“u” represents an object with a user-defined serialization format using the <code>_dump</code> instance method and <code>_load</code> class method.  Following the type byte is a symbol containing the class name.  Following the class name is a byte sequence containing the user-defined representation of the object.</p>

<p>The class method <code>_load</code> is called on the class with a string created from the byte-sequence.</p>

<h3 id="label-User+Marshal">User <a href="Marshal.html"><code>Marshal</code></a><span><a href="#label-User+Marshal">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p>“U” represents an object with a user-defined serialization format using the <code>marshal_dump</code> and <code>marshal_load</code> instance methods.  Following the type byte is a symbol containing the class name.  Following the class name is an object containing the data.</p>

<p>Upon loading a new instance must be allocated and <code>marshal_load</code> must be called on the instance with the data.</p>

</main>

</div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>.</p><p><a href="https://jamesbritt.bandcamp.com/">Maximum R+D</a>.  </p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

